<?php

use console\db\Migration;
use yii\helpers\Json;
use yii\helpers\Console;
use yii\db\Query;
use yii\db\Expression;

/**
 * 格式化图集表
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class m300020_000007_t_sns_dynamic_gallery_fill_2 extends Migration {

    /**
     * 更新图片路径
     * @inheritdoc
     */
    public $tableName = '{{%sns_dynamic_gallery}}';

    /**
     * 给原图片追加路径
     * @inheritdoc
     */
    public function safeUp() {
        $sql = "update `ln_sns_dynamic_gallery` set `original`=CONCAT('/uploads',`original`) where LEFT(`original`,13)='/attachments/';";
        $this->db->createCommand($sql)->execute();
    }

}
